<template>
  <div class="reportFormPage">
    <div class="report-dom">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>

      <div class="topTwoBox">
        <div class="centerName">无机结合料稳定材料最大干密度、最佳含水量试验检测记录表</div>
        <div class="codeText">
          <tr>
            JGLQ09005a
          </tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>记录编号：</span>
          <span class="placeholder">{{ form.jilbh }}</span>
        </div>
      </div>
      <div class="table-border">
        <!-- .........................1111111111111111111111111111111......................................................... -->
        <table height="220px" class="top-table" align="center">
          <tbody>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程部位/用途</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="50" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>

                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>

            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验检测日期</span>
              </td>
               <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验条件</span>
              </td>
              <td v-if="isPdf" width="35%">
                温度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                ℃；湿度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span
                >%RH
              </td>
              <td v-else width="35%">
                温度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" class="height100" style="width: 15%" />℃；湿度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" class="height100" style="width: 15%" />%RH
              </td>
            </tr>

            <tr>
              <td height="50" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="50" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="120px" class="middle-table">
          <tr trindex="0">
            <td colspan="1" height="42px" width="15%">材料名称规格</td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg1 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg1" @focus="handleFocus('cailmcgg1')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 0)" :ref="'0_0'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg2 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg2" @focus="handleFocus('cailmcgg2')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 1)" :ref="'0_1'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg3 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg3" @focus="handleFocus('cailmcgg3')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 2)" :ref="'0_2'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg4 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg4" @focus="handleFocus('cailmcgg4')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 3)" :ref="'0_3'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg5 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg5" @focus="handleFocus('cailmcgg5')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 4)" :ref="'0_4'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg6 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg6" @focus="handleFocus('cailmcgg6')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 5)" :ref="'0_5'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.cailmcgg7 }}</span>
              <el-input v-else type="textarea" v-model="form.cailmcgg7" @focus="handleFocus('cailmcgg7')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 0, 6)" :ref="'0_6'" />
            </td>
          </tr>
          <tr trindex="1">
            <td colspan="1" height="42px" width="15%">产地</td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand1 }}</span>
              <el-input v-else type="textarea" v-model="form.chand1" @focus="handleFocus('chand1')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 0)" :ref="'1_0'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand2 }}</span>
              <el-input v-else type="textarea" v-model="form.chand2" @focus="handleFocus('chand2')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 1)" :ref="'1_1'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand3 }}</span>
              <el-input v-else type="textarea" v-model="form.chand3" @focus="handleFocus('chand3')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 2)" :ref="'1_2'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand4 }}</span>
              <el-input v-else type="textarea" v-model="form.chand4" @focus="handleFocus('chand4')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 3)" :ref="'1_3'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand5 }}</span>
              <el-input v-else type="textarea" v-model="form.chand5" @focus="handleFocus('chand5')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 4)" :ref="'1_4'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand6 }}</span>
              <el-input v-else type="textarea" v-model="form.chand6" @focus="handleFocus('chand6')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 5)" :ref="'1_5'" />
            </td>
            <td colspan="1" class="middele-td">
              <span v-if="isPdf">{{ form.chand7 }}</span>
              <el-input v-else type="textarea" v-model="form.chand7" @focus="handleFocus('chand7')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 1, 6)" :ref="'1_6'" />
            </td>
          </tr>
          <tr trindex="2">
            <td colspan="1" height="35px" width="15%">比例</td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil1" @focus="handleFocus('bil1')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 0)" :ref="'2_0'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil2" @focus="handleFocus('bil2')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 1)" :ref="'2_1'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil3" @focus="handleFocus('bil3')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 2)" :ref="'2_2'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil4" @focus="handleFocus('bil4')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 3)" :ref="'2_3'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil5" @focus="handleFocus('bil5')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 4)" :ref="'2_4'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil6" @focus="handleFocus('bil6')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 5)" :ref="'2_5'" />
            </td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.bil7" @focus="handleFocus('bil7')" @blur="setWdclzdgmdBgJiancjg()" @keydown.native="handleKeyDown($event, 2, 6)" :ref="'2_6'" />
            </td>
          </tr>
        </table>
        <table height="80px" class="middle-table">
          <tr trindex="3">
            <td colspan="1" width="15%">试验方法类别</td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.shiyfflb" @focus="handleFocus('shiyfflb')" @keydown.native="handleKeyDown($event, 3, 0)" :ref="'3_0'"/>
            </td>
            <td colspan="1" width="20%">筒容积(cm3)</td>
            <td colspan="1">
              <el-input v-model="form.tongrj" @focus="handleFocus('tongrj')" @keydown.native="handleKeyDown($event, 3, 1)" :ref="'3_1'"/>
            </td>
            <td colspan="1" width="25%">5-38mm颗粒含量(%)</td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.klhl538mm" @focus="handleFocus('klhl538mm')" @keydown.native="handleKeyDown($event, 3, 2)" :ref="'3_2'"/>
            </td>
          </tr>
          <tr trindex="4">
            <td colspan="1" width="15%">落距(cm)</td>
            <td colspan="1">
              <el-input v-model="form.luoj" @keydown.native="handleKeyDown($event, 4, 0)" :ref="'4_0'"/>
            </td>
            <td colspan="1" width="15%">每层击数</td>
            <td colspan="1">
              <el-input v-model="form.meicjs" @keydown.native="handleKeyDown($event, 4, 1)" :ref="'4_1'"/>
            </td>
            <td colspan="1" width="25%">击锤质量(kg)</td>
            <td colspan="1" class="middele-td">
              <el-input v-model="form.jiczl" @keydown.native="handleKeyDown($event, 4, 2)" :ref="'4_2'"/>
            </td>
          </tr>
        </table>
        <table height="420px" class="middle-table">
          <tbody>
            <tr trindex="5">
              <td colspan="2" height="30" class="td2-1">试验次数</td>
              <td colspan="2" class="td2-2">1</td>
              <td colspan="2" class="td2-2">2</td>
              <td colspan="2" class="td2-2">3</td>
            </tr>
            <tr trindex="6">
              <td colspan="1" rowspan="4" width="7%">
                密
                <br />度
              </td>
              <td colspan="1" rowspan="1">筒+土质量(g)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].tongjstzl" @blur="calculateShitzl(0)" @keydown.native="handleKeyDown($event, 5, 0)" :ref="'5_0'"/>
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].tongjstzl" @blur="calculateShitzl(1)" @keydown.native="handleKeyDown($event, 5, 1)" :ref="'5_1'"/>
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].tongjstzl" @blur="calculateShitzl(2)" @keydown.native="handleKeyDown($event, 5, 2)" :ref="'5_2'"/>
              </td>
            </tr>
            <tr trindex="7">
              <td colspan="1" rowspan="1">筒质量(g)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].tongzl" class="pointer mark" @dblclick.native="showBaQjDetailView('0', 'tong')" readonly />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].tongzl" class="pointer mark" @dblclick.native="showBaQjDetailView('1', 'tong')" readonly />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].tongzl" class="pointer mark" @dblclick.native="showBaQjDetailView('2', 'tong')" readonly />
              </td>
            </tr>
            <tr trindex="8">
              <td colspan="1" rowspan="1">湿土质量(g)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].shitzl" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].shitzl" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].shitzl" disabled />
              </td>
            </tr>
            <tr trindex="9">
              <td colspan="1" rowspan="1">湿密度(g/cm3)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].shimd" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].shimd" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].shimd" disabled />
              </td>
            </tr>
            <tr trindex="10">
              <td colspan="1" rowspan="8">
                含
                <br />水 <br />率
              </td>
              <td colspan="1" rowspan="1">盒号</td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[0].heh1" class="pointer mark" @dblclick.native="showBaQjDetailView('0,1')" readonly />
              </td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[0].heh2" class="pointer mark" @dblclick.native="showBaQjDetailView('0,2')" readonly />
              </td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[1].heh1" class="pointer mark" @dblclick.native="showBaQjDetailView('1,1')" readonly />
              </td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[1].heh2" class="pointer mark" @dblclick.native="showBaQjDetailView('1,2')" readonly />
              </td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[2].heh1" class="pointer mark" @dblclick.native="showBaQjDetailView('2,1')" readonly />
              </td>
              <td colspan="1">
                <el-input v-model="form.baDetailVos[2].heh2" class="pointer mark" @dblclick.native="showBaQjDetailView('2,2')" readonly />
              </td>
            </tr>
            <tr trindex="11">
              <td colspan="1" rowspan="1">盒+湿土质量(g)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hejstzl1" @blur="calculate(0, 1)" @keydown.native="handleKeyDown($event, 6, 0)" :ref="'6_0'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hejstzl2" @blur="calculate(0, 2)" @keydown.native="handleKeyDown($event, 6, 1)" :ref="'6_1'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hejstzl1" @blur="calculate(1, 1)" @keydown.native="handleKeyDown($event, 6, 2)" :ref="'6_2'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hejstzl2" @blur="calculate(1, 2)" @keydown.native="handleKeyDown($event, 6, 3)" :ref="'6_3'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hejstzl1" @blur="calculate(2, 1)" @keydown.native="handleKeyDown($event, 6, 4)" :ref="'6_4'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hejstzl2" @blur="calculate(2, 2)" @keydown.native="handleKeyDown($event, 6, 5)" :ref="'6_5'"/>
              </td>
            </tr>
            <tr trindex="12">
              <td colspan="1" rowspan="1">盒+干土质量(g)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hejgtzl1" @blur="calculate(0, 1)" @keydown.native="handleKeyDown($event, 7, 0)" :ref="'7_0'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hejgtzl2" @blur="calculate(0, 2)" @keydown.native="handleKeyDown($event, 7, 1)" :ref="'7_1'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hejgtzl1" @blur="calculate(1, 1)" @keydown.native="handleKeyDown($event, 7, 2)" :ref="'7_2'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hejgtzl2" @blur="calculate(1, 2)" @keydown.native="handleKeyDown($event, 7, 3)" :ref="'7_3'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hejgtzl1" @blur="calculate(2, 1)" @keydown.native="handleKeyDown($event, 7, 4)" :ref="'7_4'"/>
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hejgtzl2" @blur="calculate(2, 2)" @keydown.native="handleKeyDown($event, 7, 5)" :ref="'7_5'"/>
              </td>
            </tr>
            <tr trindex="13">
              <td colspan="1" rowspan="1">盒质量(g)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hezl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hezl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hezl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hezl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hezl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hezl2" disabled />
              </td>
            </tr>
            <tr trindex="14">
              <td colspan="1" rowspan="1">水质量(g)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].shuifzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].shuifzl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].shuifzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].shuifzl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].shuifzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].shuifzl2" disabled />
              </td>
            </tr>
            <tr trindex="15">
              <td colspan="1" rowspan="1">干土质量(g)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].gantzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].gantzl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].gantzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].gantzl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].gantzl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].gantzl2" disabled />
              </td>
            </tr>
            <tr trindex="16">
              <td colspan="1" rowspan="1">含水量(%)</td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hansl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hansl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hansl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hansl2" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hansl1" disabled />
              </td>
              <td colspan="1">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hansl2" disabled />
              </td>
            </tr>
            <tr trindex="17">
              <td colspan="1" rowspan="1">平均含水量(%)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].hanslpjz" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].hanslpjz" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].hanslpjz" disabled />
              </td>
            </tr>
            <tr trindex="18">
              <td colspan="2" rowspan="1">干密度(g/cm3)</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[0].ganmd" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[1].ganmd" disabled />
              </td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.baDetailVos[2].ganmd" disabled />
              </td>
            </tr>
            <tr trindex="19">
              <td colspan="2" rowspan="1">干密度平均值(g/cm3)</td>
              <td colspan="6">
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.ganmdpjz" disabled />
              </td>
            </tr>

            <!--          <tr trindex="16">-->
            <!--            <td colspan="14" class="echarts-border">-->
            <!--              <table-line-log-more-chart :className="'echarts-border'" :chartData="chartData" :xMin="chartData.xMin" :xMax="chartData.xMax" :yMin="chartData.yMin" :yMax="chartData.yMax" :isSmooth="true" :minorSplitLine="true"></table-line-log-more-chart>-->
            <!--            </td>-->
            <!--          </tr>-->
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="60px" class="bottom-table">
          <tr>
            <td>
              <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
            </td>
          </tr>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">记录：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">复核：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <ba-qj-detail-view ref="baQjDetailViewRef" :excelId="excelId" :shiyjcrq="form.shiyjcrq" @select="selectBaQjDetail"></ba-qj-detail-view>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
  </div>
</template>

<script>
import { handleFocus, emptyConvert, handleKeyDown } from "@/views/reportForms/utils";
import { getWjjhlWdclzdgmdBsInfo } from "@/api/report_wjjhl/wjjhlWdclzdgmdBsInfo";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BaQjDetailView from "@/views/sycs/baQjDetail/BaQjDetailView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";

import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";
export default {
  name: "wdclzdgmd",
  components: {
    BsInstrumentView,
    BaQjDetailView,
    BsJiancyjView,
    BsJudgeBaseView
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    page: {
      type: Number,
      default: () => 0
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    printEmpty: {
      type: Boolean,
      default: () => false
    }
  },
  data() {
    return {
      // 表单参数
      form: {
        baDetailVos: [{}, {}, {}, {}, {}]
      },
      chartData: {
        xName: "含水率（%）",
        yName: "干密度（g/ cm3）",
        xData: [],
        yData: [],
        seriesData: [],
        time: "",
        xMin: 2,
        xMax: 14,
        yMin: 1.7,
        yMax: 2.2
      }
    };
  },
  watch: {
    isPdf(newVal, oldVal) {
      this.form = { ...emptyConvert(this.form, newVal) };
    }
  },
  created() {
    // console.log("this.excelId: ", this.excelId);
    this.getInfo();
  },
  methods: {
    // 获取详情
    getInfo() {
      getWjjhlWdclzdgmdBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
      });
    },
    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
      Bus.$emit("setWdclzdgmdBgJiancyj", { jiancyj: this.form.jiancyj, jiancyjIds: this.form.jiancyjIds });
    },
    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
       this.form.pandyjIds = info.ids;
      this.form.pandyj = info.label;
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
      Bus.$emit("setWdclzdgmdBgZhuyyqsbmcjbh", { zhuyyqsbmcjbh: this.form.zhuyyqsbmcjbh, shebIds: this.form.shebIds });
    },
    // 显示盒号列表
    showBaQjDetailView(type, label) {
      this.label = label;
      if (label != "tong") {
        this.collectHehId();
      }
      this.$refs.baQjDetailViewRef.init(type, this.form.hehIdList);
    },
    // 盒号选择
    selectBaQjDetail(type, obj) {
      if (this.label == "tong") {
        // this.form.baDetailVos[type]["tongrj"] = obj.tongrj;
        // this.form.baDetailVos[type]["tongzl"] = obj.quality;
        this.form.tongrj = obj.tongrj;
        for (let index = 0; index < 5; index++) {
          this.form.baDetailVos[index]["tongzl"] = obj.quality;
        }
        this.calculateShitzl(type);
        return;
      }
      if (type.length != 3) {
        return;
      }
      const arr = type.split(",");
      this.form.baDetailVos[arr[0]]["heh" + arr[1]] = obj.hh;
      this.form.baDetailVos[arr[0]]["heh" + arr[1] + "Id"] = obj.detailId;
      this.form.baDetailVos[arr[0]]["hezl" + arr[1]] = obj.quality;
      this.calculate(arr[0], arr[1]);
    },
    // 计算湿土质量
    calculateShitzl(type) {
      const tongrj = this.form.tongrj;
      const tongzl = this.form.baDetailVos[type].tongzl;
      const tongjstzl = this.form.baDetailVos[type].tongjstzl;
      if (!tongrj || !tongzl || !tongjstzl) {
        this.form.baDetailVos[type].shitzl = "";
        this.form.baDetailVos[type].shimd = "";
        this.calculateGanmd(type);
        return;
      }
      // 湿土质量(g) = 筒＋湿土质量（g） - 筒质量（g）
      this.form.baDetailVos[type].shitzl = decimal.subtract(tongjstzl, tongzl, 0);
      // 湿密度 = 湿土质量 / 筒容积
      this.form.baDetailVos[type].shimd = decimal.divide(this.form.baDetailVos[type].shitzl, tongrj, 3);
      this.calculateGanmd(type);
    },
    // 计算干密度
    calculateGanmd(type) {
      if (!this.form.baDetailVos[type].shimd || !this.form.baDetailVos[type].hanslpjz) {
        this.form.baDetailVos[type].ganmd = "";
        this.calculateGanmdpjz();
        return;
      }
      // 干密度 = 湿密度 / (1+平均含水率)
      this.form.baDetailVos[type].ganmd = decimal.divide(decimal.multiply(this.form.baDetailVos[type].shimd, 100, 3), decimal.add(100, this.form.baDetailVos[type].hanslpjz, 3), 3);
      this.calculateGanmdpjz();
    },
    // 计算平均干密度
    calculateGanmdpjz() {
      let count = 0;
      let num = 0;
      this.form.baDetailVos.forEach((item) => {
        if (item.ganmd) {
          num = decimal.add(num, item.ganmd, 3);
          count++;
        }
      });
      if (count == 0) {
        this.form.ganmdpjz = null;
      } else {
        this.form.ganmdpjz = decimal.divide(num, count, 3);
      }
      this.setWdclzdgmdBgJiancjg();
    },
    // 计算
    calculate(arrType, type) {
      if (!this.form.baDetailVos[arrType]["hejstzl" + type] || !this.form.baDetailVos[arrType]["hejgtzl" + type]) {
        this.form.baDetailVos[arrType]["shuifzl" + type] = "";
        this.form.baDetailVos[arrType]["gantzl" + type] = "";
        this.form.baDetailVos[arrType]["hansl" + type] = "";
        this.form.baDetailVos[type]["hanslpjz"] = "";
        this.calculateHanslpjz(arrType);
        return;
      }
      // 水分质量(g) = (盒+湿土质量(g)) -(盒+干土质量(g))
      this.form.baDetailVos[arrType]["shuifzl" + type] = decimal.subtract(this.form.baDetailVos[arrType]["hejstzl" + type], this.form.baDetailVos[arrType]["hejgtzl" + type]);
      if (!this.form.baDetailVos[arrType]["hezl" + type]) {
        this.form.baDetailVos[arrType]["gantzl" + type] = "";
        this.form.baDetailVos[arrType]["hansl" + type] = "";
        this.form.baDetailVos[type]["hanslpjz"] = "";
        this.calculateHanslpjz(arrType);
        return;
      }
      // 干土质量（g） = (盒+干土质量(g)) -(盒质量(g))
      this.form.baDetailVos[arrType]["gantzl" + type] = decimal.subtract(this.form.baDetailVos[arrType]["hejgtzl" + type], this.form.baDetailVos[arrType]["hezl" + type]);
      // 含水率(%) = (水分质量(g)) -(干土质量（g）) * 100%
      this.form.baDetailVos[arrType]["hansl" + type] = decimal.divide(decimal.multiply(this.form.baDetailVos[arrType]["shuifzl" + type], 100, 1), this.form.baDetailVos[arrType]["gantzl" + type], 1);
      this.calculateHanslpjz(arrType);
    },
    // 计算平均含水率
    calculateHanslpjz(type) {
      if (!this.form.baDetailVos[type]["hansl1"] || !this.form.baDetailVos[type]["hansl2"]) {
        this.form.baDetailVos[type]["hanslpjz"] = "";
        this.calculateGanmd(type);
        return;
      }
      // 含水率平均值(%) = (J+K)/2
      this.form.baDetailVos[type]["hanslpjz"] = decimal.divide(decimal.add(this.form.baDetailVos[type]["hansl1"], this.form.baDetailVos[type]["hansl2"], 1), 2, 1);
      this.calculateGanmd(type);
    },
    // 给报告传值
    setWdclzdgmdBgJiancjg() {
      Bus.$emit("setWdclzdgmdBgJiancjg", this.form);
    },

    // 汇总盒号id
    collectHehId() {
      const arr = ["0,1", "0,2", "1,1", "1,2", "2,1", "2,2"];
      let hehIdList = [];
      arr.forEach((item) => {
        const strArr = item.split(",");
        const hehId = this.form.baDetailVos[strArr[0]]["heh" + strArr[1] + "Id"];
        if (hehId) {
          hehIdList.push(hehId);
        }
      });
      this.form.hehIdList = hehIdList;
    },
    submitForm() {
      this.collectHehId();
      return this.form;
    },
    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [6, 6, 6, 2, 2, 2, 5, 5];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>

<style scoped>
.middele-td {
  width: calc((100% - 15%) / 7);
}

.td2-1 {
  width: calc((100% - 15%) / 7 + 15%);
}

.td2-2 {
  width: calc((100% - 15%) / 7 * 2);
}

/* .td1 {
                                                                                                                  width: calc(100% / 14 * 1);
                                                                                                                }

                                                                                                                .td2 {
                                                                                                                  width: calc(100% / 14 * 2);
                                                                                                                }

                                                                                                                .td3 {
                                                                                                                  width: calc(100% / 14 * 3);
                                                                                                                }

                                                                                                                .td4 {
                                                                                                                  width: calc(100% / 14 * 4);
                                                                                                                }

                                                                                                                .td5 {
                                                                                                                  width: calc(100% / 14 * 5);
                                                                                                                } */

.echarts-border {
  width: calc(210mm - 40mm - 8px);
  height: 176px;
  padding: 2px !important;
  background-color: #ffffff !important;
}
</style>
